package cn.schoolwow.workflow.test.module.analyzeWorkReport.audit.action;

import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;
import cn.schoolwow.workflow.QuickWorkFlow;
import cn.schoolwow.workflow.domain.instance.StartWorkFlowRequest;
import org.junit.Assert;

public class DeleteDefinitionTestCaseFlow implements BusinessFlow {
    @Override
    public void executeBusinessFlow(FlowContext flowContext) throws Exception {
        StartWorkFlowRequest startWorkFlowRequest = flowContext.checkInstanceData(StartWorkFlowRequest.class);
        QuickWorkFlow quickWorkFlow = flowContext.checkInstanceData(QuickWorkFlow.class);

        quickWorkFlow.deleteWorkFlowDefinition(startWorkFlowRequest.definitionName);
        Assert.assertFalse(quickWorkFlow.hasDeploy(startWorkFlowRequest.definitionName));
    }

    @Override
    public String name() {
        return "分析工作报告-删除工作流定义";
    }

}
